import Vue from 'vue'
// 引入路由插件
import VueRouter from 'vue-router'
// 加载首页，首页不需要懒加载
import Movie from '../views/home/Movie.vue'

Vue.use(VueRouter)
    //重定向

const routes = [
    //重定向
    {
        path: "/",
        redirect: "/home"
    },
    {
        path: '/home',
        name: 'Movie',
        component: Movie,
        //配置子路由
        children: [
            { path: '/home', redirect: '/home/reying' },
            {
                path: "reying",
                name: "reying",
                component: () =>
                    import ( /* webpackChunkName: "reying" */ '../views/home/Reying.vue')
            },
            {
                path: "yingyuan",
                name: "yingyuan",
                component: () =>
                    import ( /* webpackChunkName: "yingyuan" */ '../views/home/Yingyuan.vue')
            },
            {
                path: "daiying",
                name: "daiying",
                component: () =>
                    import ( /* webpackChunkName: "daiying" */ '../views/home/Daiying.vue')
            },
            {
                path: "jingdian",
                name: "jingdian",
                component: () =>
                    import ( /* webpackChunkName: "jingdian" */ '../views/home/Jingdian.vue')
            },

        ]
    },
    {
        path: '/video',
        name: 'Video',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () =>
            import ( /* webpackChunkName: "video" */ '../views/Video.vue')
    }, {
        path: '/minivideo',
        name: 'MiniVideo',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () =>
            import ( /* webpackChunkName: "minivideo" */ '../views/MiniVideo.vue')
    }, {
        path: '/show',
        name: 'Show',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () =>
            import ( /* webpackChunkName: "show" */ '../views/Show.vue')
    }, {
        path: '/me',
        name: 'Me',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () =>
            import ( /* webpackChunkName: "me" */ '../views/Me.vue')
    }, {
        path: '/item/:id', //需要传递参数
        name: 'Item',
        component: () =>
            import ( /* webpackChunkName: "item" */ '../views/Item.vue')
    },{
        path:"/citylist",
        name:"Citylist",
        component: () =>
        import ( /* webpackChunkName: "citylist" */ '../views/Citylist.vue')
    },
     {
        path: '*',
        name: "My404",
        component: () =>
            import ( /* webpackChunkName: "my404" */ '../views/home/My404.vue')
    }


]

const router = new VueRouter({
    routes
})

export default router